<html>
<head><meta charset="utf-8"><title>auto trait unsoundness · wg-traits · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/index.html">wg-traits</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html">auto trait unsoundness</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="237828524"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237828524" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237828524">(May 07 2021 at 14:07)</a>:</h4>
<p><span class="user-mention" data-user-id="216206">@lcnr</span></p>



<a name="237828548"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237828548" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237828548">(May 07 2021 at 14:07)</a>:</h4>
<p>maybe I should give this a better topic title :)</p>



<a name="237828594"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237828594" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237828594">(May 07 2021 at 14:07)</a>:</h4>
<p>auto trait unsoundness?</p>



<a name="237828634"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237828634" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237828634">(May 07 2021 at 14:08)</a>:</h4>
<p>is what i assume we're going to talk about?</p>



<a name="237828685"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237828685" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237828685">(May 07 2021 at 14:08)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/issues/84857">#84857</a></p>



<a name="237828791"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237828791" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237828791">(May 07 2021 at 14:08)</a>:</h4>
<p>I <em>think</em> so</p>



<a name="237828826"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237828826" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237828826">(May 07 2021 at 14:09)</a>:</h4>
<p>true confessions: I was hoping you'd open the topic because I wasn't quite sure</p>



<a name="237828897"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237828897" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237828897">(May 07 2021 at 14:09)</a>:</h4>
<p>we do have a bunch of things which deserve some time ^^</p>



<a name="237828921"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237828921" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237828921">(May 07 2021 at 14:09)</a>:</h4>
<p>but i think that the auto trait stuff is probably to most relevant rn</p>



<a name="237829062"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237829062" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237829062">(May 07 2021 at 14:10)</a>:</h4>
<p>did you already look at <a href="https://github.com/rust-lang/rust/issues/84857">#84857</a>?</p>



<a name="237829075"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237829075" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237829075">(May 07 2021 at 14:10)</a>:</h4>
<p>ok so let me read this issue more closely</p>



<a name="237829318"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237829318" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237829318">(May 07 2021 at 14:12)</a>:</h4>
<p>ok so</p>



<a name="237829327"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237829327" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237829327">(May 07 2021 at 14:12)</a>:</h4>
<p>the relevant src: <a href="https://github.com/rust-lang/rust/blob/e5f83d24aee866a14753a7cedbb4e301dfe5bef5/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs#L300-L302">https://github.com/rust-lang/rust/blob/e5f83d24aee866a14753a7cedbb4e301dfe5bef5/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs#L300-L302</a></p>



<a name="237829344"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237829344" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237829344">(May 07 2021 at 14:12)</a>:</h4>
<p>the question of whether this is unsound comes down to how we expect Send to apply</p>



<a name="237829414"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237829414" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237829414">(May 07 2021 at 14:12)</a>:</h4>
<p>"whether", not "why"?</p>



<a name="237829457"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237829457" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237829457">(May 07 2021 at 14:13)</a>:</h4>
<p>this is a safe (using <code>UnwindSafe</code> instead of <code>Send</code>) segfault</p>



<a name="237829650"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237829650" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237829650">(May 07 2021 at 14:14)</a>:</h4>
<p>well</p>



<a name="237829699"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237829699" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237829699">(May 07 2021 at 14:14)</a>:</h4>
<p>ok :) <em>why</em></p>



<a name="237829750"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237829750" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237829750">(May 07 2021 at 14:15)</a>:</h4>
<p>basically what <span class="user-mention" data-user-id="232957">@Jack Huey</span> said here:</p>
<blockquote>
<p>I think there was some discussion previously in wg-traits that an implicit impl should never be considered if there is an explicit impl. And I think that makes sense and would fix this. It isn't fully backwards compatible though, but I'm unsure how often that would get run into in practice.</p>
</blockquote>



<a name="237829787"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237829787" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237829787">(May 07 2021 at 14:15)</a>:</h4>
<p>there has been a long-standing debate about whether one should think of auto traits as <em>always</em> adding an implicit impl or not</p>



<a name="237829821"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237829821" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237829821">(May 07 2021 at 14:15)</a>:</h4>
<p>my preference was to think of them as adding an implicit impl only if no explicit impl exists, for some definition of exists</p>



<a name="237829837"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237829837" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237829837">(May 07 2021 at 14:15)</a>:</h4>
<p>Oh hey, that's me</p>



<a name="237829847"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237829847" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237829847">(May 07 2021 at 14:15)</a>:</h4>
<p>however, you showed me some examples of how stable behavior would change iirc</p>



<a name="237829853"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237829853" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237829853">(May 07 2021 at 14:15)</a>:</h4>
<p>I wonder if we have notes</p>



<a name="237829868"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237829868" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237829868">(May 07 2021 at 14:15)</a>:</h4>
<p>yeah, i think that's what we want</p>



<a name="237829875"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237829875" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237829875">(May 07 2021 at 14:16)</a>:</h4>
<p>this issue raises the stakes :)</p>



<a name="237829998"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237829998" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237829998">(May 07 2021 at 14:16)</a>:</h4>
<p>the semantics that I "intended" was something like this:</p>
<ul>
<li>you can only implement auto traits where the Self type is a "local struct"</li>
</ul>



<a name="237830009"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237830009" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237830009">(May 07 2021 at 14:16)</a>:</h4>
<p>(let's ignore the other cases for a second)</p>



<a name="237830049"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237830049" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237830049">(May 07 2021 at 14:17)</a>:</h4>
<p>if there is an impl with any polarity for a given struct, it does not have any automatic impls</p>



<a name="237830076"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237830076" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237830076">(May 07 2021 at 14:17)</a>:</h4>
<p>so kind of "if you see explicit impls, you see everything that exists for that struct'</p>



<a name="237830094"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237830094" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237830094">(May 07 2021 at 14:17)</a>:</h4>
<p>this is what chalk implements</p>



<a name="237830105"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237830105" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237830105">(May 07 2021 at 14:17)</a>:</h4>
<p>it is not what rustc implements</p>



<a name="237830118"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237830118" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237830118">(May 07 2021 at 14:17)</a>:</h4>
<p>(apparently) :)</p>



<a name="237830294"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237830294" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237830294">(May 07 2021 at 14:19)</a>:</h4>
<p>so, to quickly give some background: I think we can either 1) always consider the implicit impl with a lower priority or 2) consistently discard the implicit impl if an explicit one exists</p>



<a name="237830325"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237830325" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237830325">(May 07 2021 at 14:19)</a>:</h4>
<p>let's walk through this in a bit more detail</p>



<a name="237830334"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237830334" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237830334">(May 07 2021 at 14:19)</a>:</h4>
<p>2) is both what I strongly prefer and what you've intended before</p>



<a name="237830358"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237830358" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237830358">(May 07 2021 at 14:19)</a>:</h4>
<p>do you remember the converastion I keep referring to where you told me how that would change stable behavior?</p>



<a name="237830370"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237830370" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237830370">(May 07 2021 at 14:19)</a>:</h4>
<p>it might've been someone else :)</p>



<a name="237830386"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237830386" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237830386">(May 07 2021 at 14:19)</a>:</h4>
<p>I'd like to collect all the notes in one place and propose a path forward</p>



<a name="237830395"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237830395" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237830395">(May 07 2021 at 14:20)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116009">nikomatsakis</span> <a href="#narrow/stream/144729-wg-traits/topic/auto.20trait.20unsoundness/near/237830358">said</a>:</p>
<blockquote>
<p>do you remember the converastion I keep referring to where you told me how that would change stable behavior?</p>
</blockquote>
<p>both do <span aria-label="sweat smile" class="emoji emoji-1f605" role="img" title="sweat smile">:sweat_smile:</span></p>



<a name="237830412"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237830412" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237830412">(May 07 2021 at 14:20)</a>:</h4>
<p>hackmd: <a href="https://hackmd.io/8mcP_izdSoKb1rIlkWTdKQ">https://hackmd.io/8mcP_izdSoKb1rIlkWTdKQ</a></p>



<a name="237830482"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237830482" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237830482">(May 07 2021 at 14:20)</a>:</h4>
<p>yeah, I mean, we <em>have</em> to change stable behavior somehow, since I-unsound :)</p>



<a name="237830489"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237830489" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237830489">(May 07 2021 at 14:20)</a>:</h4>
<p>let me quickly copy the example where 1) breaks stuff</p>



<a name="237831335"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237831335" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237831335">(May 07 2021 at 14:25)</a>:</h4>
<p>I don't really understand what "lower priority" means</p>



<a name="237831350"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237831350" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237831350">(May 07 2021 at 14:26)</a>:</h4>
<p>esp. for an auto trait</p>



<a name="237831408"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237831408" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237831408">(May 07 2021 at 14:26)</a>:</h4>
<p>to discard the auto candidate during winnowing</p>



<a name="237831437"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237831437" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237831437">(May 07 2021 at 14:26)</a>:</h4>
<p>i think i have a branch for this</p>



<a name="237831494"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237831494" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237831494">(May 07 2021 at 14:26)</a>:</h4>
<p>pretty much: drop <code>AutoImplCandidate</code>s here: <a href="https://github.com/rust-lang/rust/blob/e5f83d24aee866a14753a7cedbb4e301dfe5bef5/compiler/rustc_trait_selection/src/traits/select/mod.rs#L1340-L1341">https://github.com/rust-lang/rust/blob/e5f83d24aee866a14753a7cedbb4e301dfe5bef5/compiler/rustc_trait_selection/src/traits/select/mod.rs#L1340-L1341</a></p>



<a name="237831504"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237831504" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237831504">(May 07 2021 at 14:26)</a>:</h4>
<p>so operational :)</p>



<a name="237831511"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237831511" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237831511">(May 07 2021 at 14:26)</a>:</h4>
<p>ok</p>



<a name="237831558"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237831558" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237831558">(May 07 2021 at 14:27)</a>:</h4>
<p>I guess I know what you mean in terms of the code; I'm not sure yet how to understand that from a "logic" perspective</p>



<a name="237831577"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237831577" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237831577">(May 07 2021 at 14:27)</a>:</h4>
<p>let me define the alternatives</p>



<a name="237831647"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237831647" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237831647">(May 07 2021 at 14:27)</a>:</h4>
<p>here's the problem with "implicit impl is always generated"</p>



<a name="237831706"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237831706" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237831706">(May 07 2021 at 14:28)</a>:</h4>
<p>if you have:</p>



<a name="237831737"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237831737" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237831737">(May 07 2021 at 14:28)</a>:</h4>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">impl</span><span class="w"> </span><span class="o">!</span><span class="nb">Send</span><span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="n">Foo</span><span class="o">&lt;</span><span class="p">()</span><span class="o">&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="237831769"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237831769" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237831769">(May 07 2021 at 14:28)</a>:</h4>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">struct</span> <span class="nc">Foo</span><span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="n">f</span>: <span class="nb">Box</span><span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span><span class="w"> </span><span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="237831783"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237831783" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237831783">(May 07 2021 at 14:28)</a>:</h4>
<p>then there is implicitly:</p>



<a name="237831808"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237831808" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237831808">(May 07 2021 at 14:28)</a>:</h4>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">impl</span><span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span><span class="w"> </span><span class="nb">Send</span><span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="n">Foo</span><span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span><span class="w"> </span><span class="k">where</span><span class="w"> </span><span class="nb">Box</span><span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span><span class="w"> </span>: <span class="nb">Send</span> <span class="p">{</span><span class="w"> </span><span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="237831836"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237831836" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237831836">(May 07 2021 at 14:29)</a>:</h4>
<p>now we have overlapping Send and !Send impls, which means we need to define that as a thing that can happen</p>



<a name="237831844"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237831844" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237831844">(May 07 2021 at 14:29)</a>:</h4>
<p>I have been thinking of them as exclusive</p>



<a name="237831857"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237831857" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237831857">(May 07 2021 at 14:29)</a>:</h4>
<p>oh, true <span aria-label="sweat smile" class="emoji emoji-1f605" role="img" title="sweat smile">:sweat_smile:</span></p>



<a name="237831874"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237831874" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237831874">(May 07 2021 at 14:29)</a>:</h4>
<p>with negative impls that would also be unsound <span aria-label="laughing" class="emoji emoji-1f606" role="img" title="laughing">:laughing:</span></p>



<a name="237831877"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237831877" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237831877">(May 07 2021 at 14:29)</a>:</h4>
<p>so you wind up with a more complex logic</p>



<a name="237831890"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237831890" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237831890">(May 07 2021 at 14:29)</a>:</h4>
<p>there is a name for it:</p>



<a name="237831893"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237831893" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237831893">(May 07 2021 at 14:29)</a>:</h4>
<p>defeasible logics</p>



<a name="237831921"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237831921" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237831921">(May 07 2021 at 14:29)</a>:</h4>
<p>because the implicit impl can be "defeated" by the negative one</p>



<a name="237831980"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237831980" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237831980">(May 07 2021 at 14:30)</a>:</h4>
<p>they <em>are</em> handy, as they let you define general rules, and then carve out exceptions</p>



<a name="237832049"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237832049" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237832049">(May 07 2021 at 14:30)</a>:</h4>
<p>but I kind of feel like Rust's logic is complex enough without adding defeasability into the mix</p>



<a name="237832131"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237832131" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237832131">(May 07 2021 at 14:31)</a>:</h4>
<p>(i do prefer the second approach, but if that were to cause too many regressions) we could also completely disable auto traits if negative impls are present but keep them if there are positive ones <span aria-label="sweat smile" class="emoji emoji-1f605" role="img" title="sweat smile">:sweat_smile:</span></p>



<a name="237832140"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237832140" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237832140">(May 07 2021 at 14:31)</a>:</h4>
<p>which would be sound</p>



<a name="237832144"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237832144" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237832144">(May 07 2021 at 14:31)</a>:</h4>
<p>afaict</p>



<a name="237832160"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237832160" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237832160">(May 07 2021 at 14:31)</a>:</h4>
<p>but incredibly ugly</p>



<a name="237832172"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237832172" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237832172">(May 07 2021 at 14:31)</a>:</h4>
<p>yes</p>



<a name="237832184"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237832184" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237832184">(May 07 2021 at 14:31)</a>:</h4>
<p>I am listing the alternatives I see, and that was going to be one of the "hybrids"</p>



<a name="237832202"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237832202" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237832202">(May 07 2021 at 14:31)</a>:</h4>
<p>but it feels like -- what is the point of a positive impl?</p>



<a name="237832221"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237832221" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237832221">(May 07 2021 at 14:31)</a>:</h4>
<p>well, I guess it might cover some territory that the implicit one doesn't cover</p>



<a name="237832449"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237832449" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237832449">(May 07 2021 at 14:33)</a>:</h4>
<p>so</p>



<a name="237832472"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237832472" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237832472">(May 07 2021 at 14:33)</a>:</h4>
<p>let me read the examples you've written</p>



<a name="237832486"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237832486" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237832486">(May 07 2021 at 14:33)</a>:</h4>
<p>as I don't understand them</p>



<a name="237832524"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237832524" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237832524">(May 07 2021 at 14:33)</a>:</h4>
<p>the structure I want for the doc is:</p>



<a name="237832551"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237832551" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237832551">(May 07 2021 at 14:33)</a>:</h4>
<p>a list of options, each linking to more detailed write-ups of considerations</p>



<a name="237833662"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237833662" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237833662">(May 07 2021 at 14:40)</a>:</h4>
<p>ok, I wrote up my exmaples, going to dig into yours and see how they apply</p>



<a name="237833688"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237833688" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237833688">(May 07 2021 at 14:40)</a>:</h4>
<blockquote>
<p>HiddenRefToT</p>
</blockquote>



<a name="237833716"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237833716" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237833716">(May 07 2021 at 14:40)</a>:</h4>
<p>the question here is whether <code>fn(T): Send</code> if <code>T: Send</code>, I guess.</p>



<a name="237833735"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237833735" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237833735">(May 07 2021 at 14:41)</a>:</h4>
<p>I'm tempted to say that this phantom data is wrong</p>



<a name="237833761"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237833761" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237833761">(May 07 2021 at 14:41)</a>:</h4>
<p>We can just mention <code>MutexGuard</code></p>



<a name="237833788"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237833788" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237833788">(May 07 2021 at 14:41)</a>:</h4>
<p>yeah, I'm looking at ttps://github.com/rust-lang/rust/issues/41622</p>



<a name="237833789"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237833789" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237833789">(May 07 2021 at 14:41)</a>:</h4>
<p>as that's an actually good example <span aria-label="sweat smile" class="emoji emoji-1f605" role="img" title="sweat smile">:sweat_smile:</span></p>



<a name="237835165"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237835165" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237835165">(May 07 2021 at 14:50)</a>:</h4>
<p>i'm looking at this example</p>



<a name="237835282"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237835282" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237835282">(May 07 2021 at 14:51)</a>:</h4>
<p>I don't understandddd.......</p>



<a name="237835317"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237835317" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237835317">(May 07 2021 at 14:51)</a>:</h4>
<p>ok, maybe I do</p>



<a name="237835321"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237835321" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237835321">(May 07 2021 at 14:51)</a>:</h4>
<p>the "#### Backcompat concern: Implicit impls are currently usable" section?</p>



<a name="237835337"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237835337" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237835337">(May 07 2021 at 14:51)</a>:</h4>
<p><em>ah</em></p>



<a name="237835385"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237835385" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237835385">(May 07 2021 at 14:52)</a>:</h4>
<p>Mutexguard cheats</p>



<a name="237835405"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237835405" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237835405">(May 07 2021 at 14:52)</a>:</h4>
<p>it has an <code>&amp;'a Mutex</code> but it uses it in ways outside the API</p>



<a name="237835469"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237835469" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237835469">(May 07 2021 at 14:52)</a>:</h4>
<p>No, I was trying to understand why the implicit impl was broken</p>



<a name="237835484"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237835484" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237835484">(May 07 2021 at 14:52)</a>:</h4>
<p>this is a very good example, yes.</p>



<a name="237835512"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237835512" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237835512">(May 07 2021 at 14:53)</a>:</h4>
<p>it's almost an argument for refining the implicit impl but anyway</p>



<a name="237835835"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237835835" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237835835">(May 07 2021 at 14:55)</a>:</h4>
<p>but yes that's a good example of the kind of reasoning I think is harder</p>



<a name="237835864"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237835864" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237835864">(May 07 2021 at 14:55)</a>:</h4>
<p>and why I think PositiveSurprise is actually a kind of benefit</p>



<a name="237836147"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237836147" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237836147">(May 07 2021 at 14:56)</a>:</h4>
<blockquote>
<p>NB: The underlying problem here is that the <code>MutexGuard</code> has an <code>&amp;Mutex</code>; the auto trait considers this <code>Sync</code> because the <em>external API</em> is indeed <code>Sync</code>. But <code>MutexGuard</code> has access to internal methods and fields that make it not <code>Sync</code>. One might argue this is also a shortcoming of the implicit impl, and that it should inline the fields of <code>Mutex</code> into the impl.</p>
</blockquote>



<a name="237836203"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237836203" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237836203">(May 07 2021 at 14:57)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116009">nikomatsakis</span> <a href="#narrow/stream/144729-wg-traits/topic/auto.20trait.20unsoundness/near/237835864">said</a>:</p>
<blockquote>
<p>and why I think PositiveSurprise is actually a kind of benefit</p>
</blockquote>
<p>more to the point, I think we're just not setup to have such an expressive system at the moment :)</p>



<a name="237836336"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237836336" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237836336">(May 07 2021 at 14:58)</a>:</h4>
<p>not happy with the "#### Backcompat concern: Implicit impls are currently usable" section, rn</p>



<a name="237836387"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237836387" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237836387">(May 07 2021 at 14:58)</a>:</h4>
<p>I'm having a hard time following it <em>but</em></p>



<a name="237836405"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237836405" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237836405">(May 07 2021 at 14:58)</a>:</h4>
<p>it suggests that if we dug into marker traits</p>



<a name="237836415"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237836415" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237836415">(May 07 2021 at 14:58)</a>:</h4>
<p>going to move this as a link to <code>PositiveSurprise</code></p>



<a name="237836430"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237836430" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237836430">(May 07 2021 at 14:58)</a>:</h4>
<p>we could plausibly land this change <em>and</em> a better alternative at once?</p>



<a name="237836462"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237836462" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237836462">(May 07 2021 at 14:58)</a>:</h4>
<p>I'd like to understand a bit how this arises out of the current impl</p>



<a name="237836473"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237836473" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237836473">(May 07 2021 at 14:58)</a>:</h4>
<p>oh, I think maybe i know</p>



<a name="237836507"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237836507" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237836507">(May 07 2021 at 14:59)</a>:</h4>
<p>we reject the explicit candidate, is that it?</p>



<a name="237836549"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237836549" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237836549">(May 07 2021 at 14:59)</a>:</h4>
<p>yeah, because of <code>unsafe impl&lt;E, ...&gt; Send for Eq&lt;E, E, ...&gt;</code></p>



<a name="237836555"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237836555" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237836555">(May 07 2021 at 14:59)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116009">nikomatsakis</span> <a href="#narrow/stream/144729-wg-traits/topic/auto.20trait.20unsoundness/near/237836507">said</a>:</p>
<blockquote>
<p>we reject the explicit candidate, is that it?</p>
</blockquote>
<p>rejects if the first two arguments are not equal</p>



<a name="237836593"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237836593" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237836593">(May 07 2021 at 14:59)</a>:</h4>
<p>it's really magical how well this worked <span aria-label="sweat smile" class="emoji emoji-1f605" role="img" title="sweat smile">:sweat_smile:</span></p>



<a name="237837352"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237837352" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237837352">(May 07 2021 at 15:04)</a>:</h4>
<p>think i can go and implement the second option this weekend, so that we can get some actual data here</p>



<a name="237837493"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237837493" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237837493">(May 07 2021 at 15:04)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116009">nikomatsakis</span> <a href="#narrow/stream/144729-wg-traits/topic/auto.20trait.20unsoundness/near/237836430">said</a>:</p>
<blockquote>
<p>we could plausibly land this change <em>and</em> a better alternative at once?</p>
</blockquote>
<p>yeah <span aria-label="laughing" class="emoji emoji-1f606" role="img" title="laughing">:laughing:</span> though marker traits are also unsound currently :p</p>



<a name="237839066"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237839066" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237839066">(May 07 2021 at 15:14)</a>:</h4>
<p>(wrt incorrect auto impls) uh, there's also <a href="https://github.com/rust-lang/rust/issues/54768#issuecomment-426448372">https://github.com/rust-lang/rust/issues/54768#issuecomment-426448372</a> <span aria-label="sweat smile" class="emoji emoji-1f605" role="img" title="sweat smile">:sweat_smile:</span>  fun</p>



<a name="237846343"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237846343" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237846343">(May 07 2021 at 15:57)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> we want to remove all auto impls for <code>Foo&lt;A, B&gt;: Trait&lt;C, D&gt;</code> if there's a </p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">impl</span><span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span><span class="w"> </span><span class="n">Trait</span><span class="o">&lt;</span><span class="kt">u32</span><span class="p">,</span><span class="w"> </span><span class="nb">Vec</span><span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;&gt;</span><span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="n">Foo</span><span class="o">&lt;</span><span class="kt">i32</span><span class="p">,</span><span class="w"> </span><span class="nb">Vec</span><span class="o">&lt;</span><span class="nb">Vec</span><span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;&gt;&gt;</span><span class="w"> </span><span class="p">{}</span><span class="w"></span>
</code></pre></div>



<a name="237846354"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237846354" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237846354">(May 07 2021 at 15:57)</a>:</h4>
<p>do we <span aria-label="thinking" class="emoji emoji-1f914" role="img" title="thinking">:thinking:</span></p>



<a name="237846401"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237846401" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237846401">(May 07 2021 at 15:57)</a>:</h4>
<p>auto traits don't have trait parameters right now</p>



<a name="237846444"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237846444" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237846444">(May 07 2021 at 15:58)</a>:</h4>
<p>they can't?</p>



<a name="237846475"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237846475" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237846475">(May 07 2021 at 15:58)</a>:</h4>
<p>oh '^^</p>



<a name="237846482"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237846482" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237846482">(May 07 2021 at 15:58)</a>:</h4>
<p>maybe they can, but we shouldn't allow it :)</p>



<a name="237846495"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237846495" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237846495">(May 07 2021 at 15:58)</a>:</h4>
<p>not worth it</p>



<a name="237846553"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237846553" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237846553">(May 07 2021 at 15:58)</a>:</h4>
<p><span class="user-mention silent" data-user-id="216206">lcnr</span> <a href="#narrow/stream/144729-wg-traits/topic/auto.20trait.20unsoundness/near/237837493">said</a>:</p>
<blockquote>
<p>yeah <span aria-label="laughing" class="emoji emoji-1f606" role="img" title="laughing">:laughing:</span> though marker traits are also unsound currently :p</p>
</blockquote>
<p>yeah, I've been putting off reading into that thread, have to do that</p>



<a name="237846565"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237846565" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237846565">(May 07 2021 at 15:58)</a>:</h4>
<p>^^</p>



<a name="237871632"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237871632" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237871632">(May 07 2021 at 18:46)</a>:</h4>
<p>ok, so i started implementing the second approach in <a href="https://github.com/rust-lang/rust/issues/85048">#85048</a></p>



<a name="237871653"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237871653" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237871653">(May 07 2021 at 18:46)</a>:</h4>
<p>one issue are opaque types</p>



<a name="237871885"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237871885" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237871885">(May 07 2021 at 18:48)</a>:</h4>
<p>before we discarded auto trait impls is <code>ProjectionCandidate</code>s were present</p>



<a name="237871933"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237871933" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237871933">(May 07 2021 at 18:48)</a>:</h4>
<p>i now changed this to never discard auto impl candidates if no explicit candidate applies</p>



<a name="237872203"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237872203" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237872203">(May 07 2021 at 18:51)</a>:</h4>
<p><del>this means that while trying to confirm the auto trait candidate, we get the <code>constituent_types_for_ty</code> which causes cycles for <code>ty::Opaque</code> (probably while wf checking opaque types... not yet completely sure)</del></p>



<a name="237872572"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237872572" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237872572">(May 07 2021 at 18:53)</a>:</h4>
<p>i guess an example is</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="cp">#![feature(min_type_alias_impl_trait)]</span><span class="w"></span>

<span class="k">trait</span><span class="w"> </span><span class="n">MyTrait</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">type</span> <span class="nc">AssocType</span>: <span class="nb">Send</span><span class="p">;</span><span class="w"></span>
<span class="w">    </span><span class="k">fn</span> <span class="nf">ret</span><span class="p">(</span><span class="o">&amp;</span><span class="bp">self</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="nc">Self</span>::<span class="n">AssocType</span><span class="p">;</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">impl</span><span class="w"> </span><span class="n">MyTrait</span><span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">type</span> <span class="nc">AssocType</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="k">impl</span><span class="w"> </span><span class="nb">Send</span><span class="p">;</span><span class="w"></span>
<span class="w">    </span><span class="k">fn</span> <span class="nf">ret</span><span class="p">(</span><span class="o">&amp;</span><span class="bp">self</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="nc">Self</span>::<span class="n">AssocType</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="p">()</span><span class="w"></span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">impl</span><span class="o">&lt;'</span><span class="na">a</span><span class="o">&gt;</span><span class="w"> </span><span class="n">MyTrait</span><span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="o">&amp;'</span><span class="na">a</span><span class="w"> </span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">type</span> <span class="nc">AssocType</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="k">impl</span><span class="w"> </span><span class="nb">Send</span><span class="p">;</span><span class="w"></span>
<span class="w">    </span><span class="k">fn</span> <span class="nf">ret</span><span class="p">(</span><span class="o">&amp;</span><span class="bp">self</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="nc">Self</span>::<span class="n">AssocType</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="p">()</span><span class="w"></span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">trait</span><span class="w"> </span><span class="n">MyLifetimeTrait</span><span class="o">&lt;'</span><span class="na">a</span><span class="o">&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">type</span> <span class="nc">AssocType</span>: <span class="nb">Send</span> <span class="o">+</span><span class="w"> </span><span class="o">'</span><span class="na">a</span><span class="p">;</span><span class="w"></span>
<span class="w">    </span><span class="k">fn</span> <span class="nf">ret</span><span class="p">(</span><span class="o">&amp;</span><span class="bp">self</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="nc">Self</span>::<span class="n">AssocType</span><span class="p">;</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">impl</span><span class="o">&lt;'</span><span class="na">a</span><span class="o">&gt;</span><span class="w"> </span><span class="n">MyLifetimeTrait</span><span class="o">&lt;'</span><span class="na">a</span><span class="o">&gt;</span><span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="o">&amp;'</span><span class="na">a</span><span class="w"> </span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">type</span> <span class="nc">AssocType</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="k">impl</span><span class="w"> </span><span class="nb">Send</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="o">'</span><span class="na">a</span><span class="p">;</span><span class="w"></span>
<span class="w">    </span><span class="k">fn</span> <span class="nf">ret</span><span class="p">(</span><span class="o">&amp;</span><span class="bp">self</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="nc">Self</span>::<span class="n">AssocType</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="o">*</span><span class="bp">self</span><span class="w"></span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">main</span><span class="p">()</span><span class="w"> </span><span class="p">{}</span><span class="w"></span>
</code></pre></div>



<a name="237872846"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237872846" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237872846">(May 07 2021 at 18:55)</a>:</h4>
<p>this results in</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="n">error</span><span class="p">[</span><span class="n">E0283</span><span class="p">]</span>: <span class="nc">type</span><span class="w"> </span><span class="n">annotations</span><span class="w"> </span><span class="n">needed</span><span class="w"></span>
<span class="w"> </span><span class="o">-</span>-&gt; <span class="nc">src</span><span class="o">/</span><span class="n">main</span><span class="p">.</span><span class="n">rs</span>:<span class="mi">9</span>:<span class="mi">5</span><span class="w"></span>
<span class="w">  </span><span class="o">|</span><span class="w"></span>
<span class="mi">4</span><span class="w"> </span><span class="o">|</span><span class="w">     </span><span class="k">type</span> <span class="nc">AssocType</span>: <span class="nb">Send</span><span class="p">;</span><span class="w"></span>
<span class="w">  </span><span class="o">|</span><span class="w">                     </span><span class="o">----</span><span class="w"> </span><span class="n">required</span><span class="w"> </span><span class="n">by</span><span class="w"> </span><span class="n">this</span><span class="w"> </span><span class="n">bound</span><span class="w"> </span><span class="k">in</span><span class="w"> </span><span class="err">`</span><span class="n">MyTrait</span>::<span class="n">AssocType</span><span class="err">`</span><span class="w"></span>
<span class="o">..</span><span class="p">.</span><span class="w"></span>
<span class="mi">9</span><span class="w"> </span><span class="o">|</span><span class="w">     </span><span class="k">type</span> <span class="nc">AssocType</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="k">impl</span><span class="w"> </span><span class="nb">Send</span><span class="p">;</span><span class="w"></span>
<span class="w">  </span><span class="o">|</span><span class="w">     </span><span class="o">^^^^^^^^^^^^^^^^^^^^^^^^^^^</span><span class="w"> </span><span class="n">cannot</span><span class="w"> </span><span class="n">infer</span><span class="w"> </span><span class="k">type</span> <span class="nc">for</span><span class="w"> </span><span class="n">opaque</span><span class="w"> </span><span class="k">type</span> <span class="err">`</span><span class="k">impl</span><span class="w"> </span><span class="nb">Send</span><span class="err">`</span><span class="w"></span>
<span class="w">  </span><span class="o">|</span><span class="w"></span>
<span class="w">  </span><span class="o">=</span><span class="w"> </span><span class="n">note</span>: <span class="nc">cannot</span><span class="w"> </span><span class="n">satisfy</span><span class="w"> </span><span class="err">`</span><span class="k">impl</span><span class="w"> </span><span class="nb">Send</span>: <span class="nb">Send</span><span class="err">`</span><span class="w"></span>

<span class="n">error</span><span class="p">[</span><span class="n">E0283</span><span class="p">]</span>: <span class="nc">type</span><span class="w"> </span><span class="n">annotations</span><span class="w"> </span><span class="n">needed</span><span class="w"></span>
<span class="w">  </span><span class="o">-</span>-&gt; <span class="nc">src</span><span class="o">/</span><span class="n">main</span><span class="p">.</span><span class="n">rs</span>:<span class="mi">16</span>:<span class="mi">5</span><span class="w"></span>
<span class="w">   </span><span class="o">|</span><span class="w"></span>
<span class="mi">4</span><span class="w">  </span><span class="o">|</span><span class="w">     </span><span class="k">type</span> <span class="nc">AssocType</span>: <span class="nb">Send</span><span class="p">;</span><span class="w"></span>
<span class="w">   </span><span class="o">|</span><span class="w">                     </span><span class="o">----</span><span class="w"> </span><span class="n">required</span><span class="w"> </span><span class="n">by</span><span class="w"> </span><span class="n">this</span><span class="w"> </span><span class="n">bound</span><span class="w"> </span><span class="k">in</span><span class="w"> </span><span class="err">`</span><span class="n">MyTrait</span>::<span class="n">AssocType</span><span class="err">`</span><span class="w"></span>
<span class="o">..</span><span class="p">.</span><span class="w"></span>
<span class="mi">16</span><span class="w"> </span><span class="o">|</span><span class="w">     </span><span class="k">type</span> <span class="nc">AssocType</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="k">impl</span><span class="w"> </span><span class="nb">Send</span><span class="p">;</span><span class="w"></span>
<span class="w">   </span><span class="o">|</span><span class="w">     </span><span class="o">^^^^^^^^^^^^^^^^^^^^^^^^^^^</span><span class="w"> </span><span class="n">cannot</span><span class="w"> </span><span class="n">infer</span><span class="w"> </span><span class="k">type</span> <span class="nc">for</span><span class="w"> </span><span class="n">opaque</span><span class="w"> </span><span class="k">type</span> <span class="err">`</span><span class="k">impl</span><span class="w"> </span><span class="nb">Send</span><span class="err">`</span><span class="w"></span>
<span class="w">   </span><span class="o">|</span><span class="w"></span>
<span class="w">   </span><span class="o">=</span><span class="w"> </span><span class="n">note</span>: <span class="nc">cannot</span><span class="w"> </span><span class="n">satisfy</span><span class="w"> </span><span class="err">`</span><span class="k">impl</span><span class="w"> </span><span class="nb">Send</span>: <span class="nb">Send</span><span class="err">`</span><span class="w"></span>

<span class="n">error</span><span class="p">[</span><span class="n">E0283</span><span class="p">]</span>: <span class="nc">type</span><span class="w"> </span><span class="n">annotations</span><span class="w"> </span><span class="n">needed</span><span class="w"></span>
<span class="w">  </span><span class="o">-</span>-&gt; <span class="nc">src</span><span class="o">/</span><span class="n">main</span><span class="p">.</span><span class="n">rs</span>:<span class="mi">28</span>:<span class="mi">5</span><span class="w"></span>
<span class="w">   </span><span class="o">|</span><span class="w"></span>
<span class="mi">23</span><span class="w"> </span><span class="o">|</span><span class="w">     </span><span class="k">type</span> <span class="nc">AssocType</span>: <span class="nb">Send</span> <span class="o">+</span><span class="w"> </span><span class="o">'</span><span class="na">a</span><span class="p">;</span><span class="w"></span>
<span class="w">   </span><span class="o">|</span><span class="w">                     </span><span class="o">----</span><span class="w"> </span><span class="n">required</span><span class="w"> </span><span class="n">by</span><span class="w"> </span><span class="n">this</span><span class="w"> </span><span class="n">bound</span><span class="w"> </span><span class="k">in</span><span class="w"> </span><span class="err">`</span><span class="n">MyLifetimeTrait</span>::<span class="n">AssocType</span><span class="err">`</span><span class="w"></span>
<span class="o">..</span><span class="p">.</span><span class="w"></span>
<span class="mi">28</span><span class="w"> </span><span class="o">|</span><span class="w">     </span><span class="k">type</span> <span class="nc">AssocType</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="k">impl</span><span class="w"> </span><span class="nb">Send</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="o">'</span><span class="na">a</span><span class="p">;</span><span class="w"></span>
<span class="w">   </span><span class="o">|</span><span class="w">     </span><span class="o">^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^</span><span class="w"> </span><span class="n">cannot</span><span class="w"> </span><span class="n">infer</span><span class="w"> </span><span class="k">type</span> <span class="nc">for</span><span class="w"> </span><span class="n">opaque</span><span class="w"> </span><span class="k">type</span> <span class="err">`</span><span class="k">impl</span><span class="w"> </span><span class="nb">Send</span><span class="err">`</span><span class="w"></span>
<span class="w">   </span><span class="o">|</span><span class="w"></span>
<span class="w">   </span><span class="o">=</span><span class="w"> </span><span class="n">note</span>: <span class="nc">cannot</span><span class="w"> </span><span class="n">satisfy</span><span class="w"> </span><span class="err">`</span><span class="k">impl</span><span class="w"> </span><span class="nb">Send</span>: <span class="nb">Send</span><span class="err">`</span><span class="w"></span>
</code></pre></div>



<a name="237872936"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237872936" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237872936">(May 07 2021 at 18:56)</a>:</h4>
<p>ah, that one seems fine <span aria-label="thinking" class="emoji emoji-1f914" role="img" title="thinking">:thinking:</span></p>



<a name="237874188"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237874188" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237874188">(May 07 2021 at 19:04)</a>:</h4>
<p>ah yeah, that test was just me doing an oupsie</p>



<a name="237875551"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237875551" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237875551">(May 07 2021 at 19:13)</a>:</h4>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="cp">#![feature(const_impl_trait)]</span><span class="w"></span>
<span class="cp">#![feature(min_type_alias_impl_trait, type_alias_impl_trait, impl_trait_in_bindings)]</span><span class="w"></span>
<span class="cp">#![allow(incomplete_features)]</span><span class="w"></span>

<span class="k">type</span> <span class="nc">Foo</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="k">impl</span><span class="w"> </span><span class="nb">Send</span><span class="p">;</span><span class="w"></span>

<span class="c1">// This is not structural-match</span>
<span class="k">struct</span> <span class="nc">A</span><span class="p">;</span><span class="w"></span>

<span class="k">const</span><span class="w"> </span><span class="k">fn</span> <span class="nf">value</span><span class="p">()</span><span class="w"> </span>-&gt; <span class="nc">Foo</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">A</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
<span class="k">const</span><span class="w"> </span><span class="n">VALUE</span>: <span class="nc">Foo</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">value</span><span class="p">();</span><span class="w"></span>
</code></pre></div>



<a name="237875642"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237875642" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237875642">(May 07 2021 at 19:14)</a>:</h4>
<div class="codehilite"><pre><span></span><code>error[E0391]: cycle detected when computing type of `Foo::{opaque#0}`
  --&gt; src/lib.rs:5:12
   |
5  | type Foo = impl Send;
   |            ^^^^^^^^^
   |
note: ...which requires type-checking `VALUE`...
  --&gt; src/lib.rs:13:1
   |
13 | const VALUE: Foo = value();
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
   = note: ...which requires evaluating trait selection obligation `impl std::marker::Send: std::marker::Send`...
   = note: ...which again requires computing type of `Foo::{opaque#0}`, completing the cycle
note: cycle used when checking item types in top-level module
  --&gt; src/lib.rs:1:1
   |
1  | / #![feature(const_impl_trait)]
2  | | #![feature(min_type_alias_impl_trait, type_alias_impl_trait, impl_trait_in_bindings)]
3  | | #![allow(incomplete_features)]
4  | |
...  |
12 | | }
13 | | const VALUE: Foo = value();
   | |___________________________^
</code></pre></div>



<a name="237876027"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237876027" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237876027">(May 07 2021 at 19:16)</a>:</h4>
<p>do we want to special case auto impl candidate confirmation for opaque types so that they don't try to get the concrete type if the auto trait we're searching for is one of its <code>item_bounds</code>?</p>



<a name="237876866"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237876866" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237876866">(May 07 2021 at 19:22)</a>:</h4>
<p>or...</p>



<a name="237877110"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237877110" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237877110">(May 07 2021 at 19:24)</a>:</h4>
<p>do we want this earlier and not add an auto impl candidate for <code>ty::Opaque</code> if it contains a fitting trait predicate in its <code>item_bounds</code>?</p>



<a name="237877156"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237877156" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237877156">(May 07 2021 at 19:24)</a>:</h4>
<p>hmm <span class="user-mention" data-user-id="116009">@nikomatsakis</span> do you have any immediate thoughts about the last 5 messages?</p>



<a name="237877213"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237877213" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237877213">(May 07 2021 at 19:25)</a>:</h4>
<p>if not i can just experiment a bit</p>



<a name="237878287"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237878287" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237878287">(May 07 2021 at 19:33)</a>:</h4>
<p>also, do you know whether we previously (before 1.0) only used <code>fast_reject</code> (edit: for impl candidates) during candidate assembly instead of checking the whole trait refs</p>



<a name="237878331"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/auto%20trait%20unsoundness/near/237878331" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/auto.20trait.20unsoundness.html#237878331">(May 07 2021 at 19:33)</a>:</h4>
<p>because if we did, auto traits would have been implemented correctly</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>